package com.bingxue.edu.management.education.model.resp;

import com.alibaba.excel.annotation.ExcelProperty;
import com.bingxue.edu.common.enums.EnrollmentStatusEnum;
import com.bingxue.edu.framework.excel.converter.ExcelBooleanConverter;
import com.bingxue.edu.framework.excel.converter.ExcelDictEnumConverter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * 报名信息分页返回
 *
 * @author zq
 * @since 2024/08/21 00:02
 */
@Data
@Schema(description = "报名信息")
public class EnrollmentExportResp {

    @ExcelProperty(value = "报名id")
    private String enrollmentId;
    @ExcelProperty(value = "班级id")
    private String classId;
    @ExcelProperty(value = "班级名称")
    private String className;
    @ExcelProperty(value = "校区名称")
    private String campusName;
    @ExcelProperty(value = "主讲老师")
    private String leadTeacherName;
    @ExcelProperty(value = "销售顾问")
    private String sellerName;
    @ExcelProperty(value = "学生id")
    private String studentId;
    @ExcelProperty(value = "学生姓名")
    private String studentName;
    @ExcelProperty(value = "家长电话")
    private String studentPhone;

    @ExcelProperty(value = "报名课次数")
    private Integer enrollLessonCount;
    @ExcelProperty(value = "已上课次数")
    private Integer completedLessonCount;
    @ExcelProperty(value = "已退课次数")
    private Integer cancelLessonCount;
    @ExcelProperty(value = "剩余可转班次数")
    private Integer remainClassChangeCount;
    @ExcelProperty(value = "剩余可调课次数")
    private Integer remainLessonChangeCount;

    @ExcelProperty(value = "是否续报", converter = ExcelBooleanConverter.class)
    private Boolean isRenewal;
    @ExcelProperty(value = "报名信息状态", converter = ExcelDictEnumConverter.class)
    private EnrollmentStatusEnum status;
    @ExcelProperty(value = "备注（内部）")
    private String remark;

    public static EnrollmentExportResp of(EnrollmentResp from) {
        EnrollmentExportResp resp = new EnrollmentExportResp();
        resp.setEnrollmentId(from.getId());
        resp.setClassId(from.getClassId());
        resp.setClassName(from.getClassInfo().getName());
        resp.setCampusName(from.getCampusName());
        resp.setLeadTeacherName(from.getLeadTeacherName());
        resp.setSellerName(from.getSellerName());
        resp.setStudentId(from.getStudentId());
        resp.setStudentName(from.getStudent().getName());
        resp.setStudentPhone(from.getStudent().getParentPhone());
        resp.setEnrollLessonCount(from.getEnrollLessonCount());
        resp.setCompletedLessonCount(from.getCompletedLessonCount());
        resp.setCancelLessonCount(from.getCancelLessonCount());
        resp.setRemainClassChangeCount(from.getRemainClassChangeCount());
        resp.setRemainLessonChangeCount(from.getRemainLessonChangeCount());
        resp.setIsRenewal(from.getIsRenewal());
        resp.setStatus(from.getStatus());
        resp.setRemark(from.getRemark());
        return resp;
    }
}
